<?php

namespace common\models\credit_public_tables;

use Yii;

/**
 * This is the model class for table "{{%sl_area}}".
 *
 * @property integer $id
 * @property integer $pid
 * @property string $shortname
 * @property string $name
 * @property string $merger_name
 * @property integer $level
 * @property string $pinyin
 * @property string $code
 * @property string $zip_code
 * @property string $first
 * @property string $lng
 * @property string $lat
 */
class SlArea extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%sl_area}}';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db_public');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['pid', 'level'], 'integer'],
            [['shortname', 'name', 'pinyin', 'code', 'zip_code', 'lng', 'lat'], 'string', 'max' => 100],
            [['merger_name'], 'string', 'max' => 255],
            [['first'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'pid' => Yii::t('app', '父id'),
            'shortname' => Yii::t('app', '简称'),
            'name' => Yii::t('app', '名称'),
            'merger_name' => Yii::t('app', '全称'),
            'level' => Yii::t('app', '层级 0 1 2 省市区县'),
            'pinyin' => Yii::t('app', '拼音'),
            'code' => Yii::t('app', '长途区号'),
            'zip_code' => Yii::t('app', '邮编'),
            'first' => Yii::t('app', '首字母'),
            'lng' => Yii::t('app', '经度'),
            'lat' => Yii::t('app', '纬度'),
        ];
    }
}
